#include "stdafx.h"
#include "StepEditExport.h"
#include "StepEditDlg.h"
#include "StartChlDlg.h"

#define AFX_EXPORT_DLLCLASS
CStepEidtDll::CStepEidtDll(){
	m_pStepDlg = NULL;
	//m_pStart = NULL;
}

CStepEidtDll::~CStepEidtDll(){
	if (m_pStepDlg)
	{
		delete m_pStepDlg;
		m_pStepDlg = NULL;
	}
}

int CStepEidtDll::ShowStepEditDlg(const CString strStepFileName )
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	if (m_pStepDlg == NULL)
	{
		m_pStepDlg = new CStepEditDlg;
		theApp.m_pStepDlg = m_pStepDlg;
	}
	//CStepEditDlg dlg;
	//dlg.DoModal();
	m_pStepDlg->SetIniFile(strStepFileName);
	int nRet = m_pStepDlg->DoModal();
	nRet = m_pStepDlg->IsSaved() ? 1 : 0;
	delete m_pStepDlg;
	m_pStepDlg = NULL;
	theApp.Clear();
	return nRet;

}

int CStepEidtDll::ShowStartDlg(CString& strStepFile, int& nStart,CString& strPrjName)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	//if (!m_pStart)
	//{
	//	m_pStart =  new CStartChlDlg;
	//}
 	CStartChlDlg dlg;
 	if (IDOK == dlg.DoModal())
	{
		strStepFile = dlg.GetStepFile();
		nStart = dlg.GetStartStep();
		strPrjName = dlg.GetProjectName();
		return 0;
	}

	return -1;
}

